define(["app", "angular", "services/BaseService"], function(app, angular) {
	
	var deps = ["$http", "BaseService"];
	
	function companyResource($http, BaseService) {
        return initResource($http, BaseService.restfulUrl + "company/", BaseService.formHeader,BaseService);
    }
	
	var postHeader = {
	        "Content-Type" : "application/x-www-form-urlencoded;charset=utf-8"
	};
	
	function initResource($http, preUrl,formHeader,BaseService) {
        return {
        	save: function (companyVo) {
				return $http.post(preUrl + "register", angular.toJson(companyVo));
			},
			savePosition: function (positionVo) {
				return $http.post(preUrl + "savePosition", angular.toJson(positionVo));
			},
			auth: function (companyVo) {
				return $http.post(preUrl + "auth", angular.toJson(companyVo));
			},
			
			check: function (mobile,checkcode,type) {        		
            	return $http.get(preUrl + "check",{
                    params: {
                    	mobile:mobile,
                    	checkcode:checkcode,
                    	type:type
                    }
            	 });
            },
            bind: function (mobile,checkcode,type) {        		
            	return $http.get(preUrl + "bind",{
                    params: {
                    	mobile:mobile,
                    	checkcode:checkcode,
                    	type:type
                    }
            	 });
            },
            
			collectionResume : function(ids) {
    			return $http.post(preUrl + "collectionResume", {
    				resumeIds:angular.isArray(ids) ? ids : [ids],
    			}, {
    				headers : postHeader
    			});
    		},
    		
			saveCompanyPic: function (companyVo) {
				return $http.post(preUrl + "saveCompanyPic", angular.toJson(companyVo));
			},
			queryPostIno: function (queryType,parentId) {        		
            	return $http.get(preUrl + "queryPostIno",{
                    params: {
                    	queryType:queryType,
                    	parentId:parentId
                    }
            	 });
            },
			
			updatePosition: function (positionVo) {
				return $http.post(preUrl + "updatePosition", angular.toJson(positionVo));
			},
			queryLoginLogs: function (pageNo,pageSize,queryType) {        		
            	return $http.get(preUrl + "queryLoginLogs",{
                    params: {
                    	pageNo: pageNo,
                    	pageSize:pageSize,
                    	queryType:queryType
                    }
            	 });
            },
            queryResumeById: function (resumeId) {        		
            	return $http.get(preUrl + "queryResumeById/"+resumeId,{
                    params: {
                    	
                    }
            	 });
            },
            
			
			queryCompanyInfo: function () {        		
            	return $http.get(preUrl + "queryCompanyInfo",{
                    params: {
                    	
                    }
            	 });
            },
            
            editPosition: function (id) {        		
            	return $http.get(preUrl + "editPosition",{
                    params: {
                    	id: id
                    }
            	 });
            },
			findPassword: function (companyVo) {
				return $http.post(preUrl + "findPassword", angular.toJson(companyVo));
			},
			
			
			sendSms: function (mobile,codeType) {        		
            	return $http.get(preUrl + "sendSms",{
                    params: {
                    	mobile: mobile,
                    	codeType:codeType
                    }
            	 });
            },
            
            queryResumeList: function (pageNo,pageSize,keyWord,workYearType) {        		
            	return $http.get(preUrl + "queryResumeList",{
                    params: {
                    	pageNo: pageNo,
                    	pageSize:pageSize,
                    	keyWord:keyWord,
                    	workYearType:workYearType
                    }
            	 });
            },
            queryPositionList: function (pageNo,pageSize,keyWord) {        		
            	return $http.get(preUrl + "queryPositionList",{
                    params: {
                    	pageNo: pageNo,
                    	pageSize:pageSize,
                    	keyWord:keyWord
                    }
            	 });
            },
            
            queryDeliverResumeList: function (pageNo,pageSize,keyWord) {        		
            	return $http.get(preUrl + "queryDeliverResumeList",{
                    params: {
                    	pageNo: pageNo,
                    	pageSize:pageSize,
                    	keyWord:keyWord
                    }
            	 });
            },
            
            
            login:function(mobile,password){
                return $http.post(preUrl+"login",{
                	mobile : mobile,
                	password : password
                },{
                    headers: postHeader
                });
            },
            updateStatus:function(id,status){
                return $http.post(preUrl+"updateStatus",{
                	id : id,
                	status : status
                },{
                    headers: postHeader
                });
            },
            
            
            logout:function(){
            	return $http.post(preUrl+"logout",{
                	
                },{
                    headers: postHeader
                });
            }
			
        };
        
    }
	companyResource.$inject = deps;
	app.lazy.factory("CompanyResource", companyResource);
});
